// var $parentNode = window.parent.document;

// function $childNode(name) {
//     return window.frames[name]
// }

// // tooltips
// $('.tooltip-demo').tooltip({
//     selector: "[data-toggle=tooltip]",
//     container: "body"
// });

// // 使用animation.css修改Bootstrap Modal
// $('.modal').appendTo("body");

// $("[data-toggle=popover]").popover();


//判断当前页面是否在iframe中
if (top == this) {
    var gohome = '<div class="gohome"><a class="animated bounceInUp" href="index.html?v=4.0" title="返回首页"><i class="fa fa-home"></i></a></div>';
    $('body').append(gohome);
}

//animation.css
function animationHover(element, animation) {
    element = $(element);
    element.hover(
        function () {
            element.addClass('animated ' + animation);
        },
        function () {
            //动画完成之前移除class
            window.setTimeout(function () {
                element.removeClass('animated ' + animation);
            }, 2000);
        });
}

//拖动面板
function WinMove() {
    var element = "[class*=col]";
    var handle = ".ibox-title";
    var connect = "[class*=col]";
    $(element).sortable({
            handle: handle,
            connectWith: connect,
            tolerance: 'pointer',
            forcePlaceholderSize: true,
            opacity: 0.8,
        })
        .disableSelection();
};

var roleName = $(".rolelist");
var rootpath= location.origin +location.pathname.substring(0, location.pathname.indexOf("/", 1));
$.ajax({
	type:"GET",//请求类型
	url:rootpath+"/login/types",//请求的url
	dataType:"json",//ajax接口（请求url）返回的数据类型
	success:function(data){//data：返回数据（json对象）
		if(data != null){
			var rid = $(".rolelist").val();
			roleName.html("");
			var options = "<option value=\"0\">请选择</option>";
			for(var i = 0; i < data.length; i++){
//				alert(data[i].ty_id);
				//alert(data[i].roleName);
				options += "<option value=\""+data[i].ty_id+"\" >"+data[i].ty_name+"</option>";
			}
			roleName.html(options);
		}
	}
});

var roleName = $(".two_type");
var rootpath= location.origin +location.pathname.substring(0, location.pathname.indexOf("/", 1));
$.ajax({
	type:"GET",//请求类型
	url:rootpath+"/prouct/two_type",//请求的url
	dataType:"json",//ajax接口（请求url）返回的数据类型
	success:function(data){//data：返回数据（json对象）
		if(data != null){
			var rid = $(".two_type").val();
			roleName.html("");
			var options = "<option value=\"0\">请选择</option>";
			for(var i = 0; i < data.length; i++){
//				alert(data[i].ty_id);
				//alert(data[i].roleName);
				options += "<option value=\""+data[i].two_id+"\" >"+data[i].two_name+"</option>";
			}
			roleName.html(options);
		}
	}
});
var zoneName = $(".zone_type");
$.ajax({
	type:"GET",//请求类型
	url:rootpath+"/prouct/zone_type",//请求的url
	dataType:"json",//ajax接口（请求url）返回的数据类型
	success:function(data){//data：返回数据（json对象）
		if(data != null){
			var rid = $(".zone_type").val();
			zoneName.html("");
			var options = "<option value=\"0\">请选择</option>";
			for(var i = 0; i < data.length; i++){
//				alert(data[i].ty_id);
				//alert(data[i].roleName);
				options += "<option value=\""+data[i].id+"\" >"+data[i].typeName+"</option>";
			}
			zoneName.html(options);
		}
	}
});